import request from '@/utils/request'
const path = 'http://39.108.248.115:9000'
const Api = {
  employees: path + '/base/employees'
}

// 更新人员基础信息
export function editEmployees (parameter) {
  return request({
    url: Api.employees + '/' + parameter.partyId,
    method: 'put',
    data: parameter
  })
}

// 修改员工权限角色
export function editEmployeesRole (parameter) {
  return request({
    url: Api.employees + '/' + parameter.employeeId + '/roles',
    method: 'put',
    data: parameter.checkedKeys
  })
}

// 组织单位下的员工集
export function orgEmployees (parameter) {
  const par = '?pageNum=' + parameter.current + '&pageSize=' + parameter.pageSize +
  '&organizationId=' + parameter.organizationId + '&name=' + parameter.name
  return request({
    url: Api.employees + par,
    method: 'get'
  })
  // return request({
  //   url: Api.employees+'?organizationId='+id,
  //   method: 'get'
  // })
}

// 重置员工密码
export function resetPwd (parameter) {
  const par = parameter.Password
  return request({
    url: Api.employees + '/' + parameter.employeeId + '/reset',
    method: 'put',
    headers: { // 修改请求头
      'Content-Type': 'application/json'
    },
    data: par
  })
}

// 员工详情
export function detailEmployees (id) {
  return request({
    url: Api.employees + '/' + id,
    method: 'get'
  })
}

// 添加员工
export function addEmployees (parameter) {
  return request({
    url: Api.employees,
    method: 'post',
    data: parameter
  })
}

// 开通账号
export function openAccount (parameter) {
  return request({
    url: Api.employees + '/' + parameter.employeeId + '/openAccount',
    method: 'post',
    data: parameter
  })
}
